Skip to content

ls: use locale-aware collation for name sort#11841

Draft
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:ls-locale-sort-11831
Draft

ls: use locale-aware collation for name sort#11841
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:ls-locale-sort-11831

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

GNU ls uses strcoll() so in UTF-8 locales punctuation is reordered (e.g. '.' sorts before '#'), placing '.' and '..' first in ls -a output. uutils was always doing a byte-wise compare, diverging from GNU in non-C locales.

Wire up uucore's ICU collator for Sort::Name, gated on should_use_locale_collation() so C/POSIX locales keep the existing zero-overhead byte compare path.

Fixes #11831

GNU ls uses strcoll() so in UTF-8 locales punctuation is reordered
(e.g. '.' sorts before '#'), placing '.' and '..' first in `ls -a`
output. uutils was always doing a byte-wise compare, diverging from
GNU in non-C locales.

Wire up uucore's ICU collator for Sort::Name, gated on
should_use_locale_collation() so C/POSIX locales keep the existing
zero-overhead byte compare path.

Fixes uutils#11831
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.

@github-actions
Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 152.46 MB (+1.20 MB, +0.80%)

Significant per-binary changes:
  ls     2.08 MB ->    3.27 MB  (+1.19 MB, +57.14%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coreutils ls -alg result differs from /usr/bin/ls -alg

1 participant